[POWERPC][XEN] move idle_loop and add a "power save" hook
authorJimi Xenidis <jimix@watson.ibm.com>
Fri, 1 Sep 2006 16:31:56 +0000 (12:31 -0400)
committerJimi Xenidis <jimix@watson.ibm.com>
Fri, 1 Sep 2006 16:31:56 +0000 (12:31 -0400)
Signed-off-by: Jimi Xenidis <jimix@watson.ibm.com>
Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
xen/arch/powerpc/domain.c
xen/arch/powerpc/setup.c

index 77df5a613f227c9f48db7952dc015e9212e179c2..58a0cfa12908988f9367fbe74afd6690c4de38aa 100644 (file)
 #include <xen/shutdown.h>
 #include <xen/shadow.h>
 #include <xen/mm.h>
+#include <xen/softirq.h>
 #include <asm/htab.h>
 #include <asm/current.h>
 #include <asm/hcalls.h>
 
-extern void idle_loop(void);
-
 #define next_arg(fmt, args) ({                                              \
     unsigned long __arg;                                                    \
     switch ( *(fmt)++ )                                                     \
@@ -47,6 +46,7 @@ extern void idle_loop(void);
     }                                                                       \
     __arg;                                                                  \
 })
+extern void idle_loop(void);
 
 unsigned long hypercall_create_continuation(unsigned int op,
         const char *format, ...)
@@ -179,7 +179,6 @@ void dump_pageframe_info(struct domain *d)
     }
 }
 
-
 void context_switch(struct vcpu *prev, struct vcpu *next)
 {
     struct cpu_user_regs *stack_regs = guest_cpu_user_regs();
@@ -253,3 +252,30 @@ void domain_relinquish_resources(struct domain *d)
 void arch_dump_domain_info(struct domain *d)
 {
 }
+
+extern void sleep(void);
+static void safe_halt(void)
+{
+    int cpu = smp_processor_id();
+
+    while (!softirq_pending(cpu))
+        sleep();
+}
+
+static void default_idle(void)
+{
+    local_irq_disable();
+    if ( !softirq_pending(smp_processor_id()) )
+        safe_halt();
+    else
+        local_irq_enable();
+}
+
+void idle_loop(void)
+{
+    for ( ; ; ) {
+        page_scrub_schedule_work();
+        default_idle();
+        do_softirq();
+    }
+}
index ea11b01c8d3ce3b46aa2c5d52d273c8ebee8c68e..59c17f24921d3587fb74fec83424e9dbc83edd9e 100644 (file)
@@ -82,7 +82,6 @@ ulong isa_io_base;
 struct ns16550_defaults ns16550;
 
 extern char __per_cpu_start[], __per_cpu_data_end[], __per_cpu_end[];
-extern void idle_loop(void);
 
 /* move us to a header file */
 extern void initialize_keytable(void);
@@ -102,21 +101,6 @@ unsigned long kernel_text_end(void)
     return (unsigned long) &_etext;
 }
 
-void idle_loop(void)
-{
-    int cpu = smp_processor_id();
-
-    for ( ; ; )
-    {
-        while (!softirq_pending(cpu)) {
-            void sleep(void);
-            page_scrub_schedule_work();
-            sleep();
-        }
-        do_softirq();
-    }
-}
-
 static void __init do_initcalls(void)
 {
     initcall_t *call;
@@ -210,6 +194,8 @@ static void __init start_of_day(void)
     schedulers_start();
 }
 
+extern void idle_loop(void);
+
 void startup_cpu_idle_loop(void)
 {
     struct vcpu *v = current;